<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>瑞芬太尼输注计算器</title>
    <style>
        body {
            font-family: Arial, sans-serif;
            padding: 20px;
            max-width: 600px;
            margin: 0 auto;
            background-color: #f0f4f7;
        }
        .container {
            background: white;
            padding: 25px;
            border-radius: 10px;
            box-shadow: 0 2px 10px rgba(0,0,0,0.1);
        }
        h2 {
            color: #2c3e50;
            border-bottom: 2px solid #3498db;
            padding-bottom: 10px;
        }
        .input-group {
            margin: 15px 0;
        }
        label {
            display: block;
            margin: 10px 0;
            color: #34495e;
            font-weight: bold;
        }
        input, select {
            width: 100%;
            padding: 12px;
            border: 1px solid #bdc3c7;
            border-radius: 6px;
            font-size: 16px;
        }
        button {
            background: #3498db;
            color: white;
            border: none;
            padding: 15px;
            width: 100%;
            border-radius: 6px;
            cursor: pointer;
            font-size: 16px;
            margin-top: 15px;
        }
        button:hover {
            background: #2980b9;
        }
        .result {
            margin-top: 25px;
            padding: 20px;
            background: #ecf0f1;
            border-radius: 6px;
            line-height: 1.6;
        }
        .highlight {
            color: #e74c3c;
            font-weight: bold;
        }
    </style>
</head>
<body>
    <div class="container">
        <h2>瑞芬太尼输注计算器</h2>
        
        <div class="input-group">
            <label>患者体重 (kg):</label>
            <input type="number" id="weight" placeholder="请输入体重">
        </div>

        <div class="input-group">
            <label>选择液体速度 (ml/h):</label>
            <select id="speed">
                <option value="0.5">0.5 ml/h (1μg/kg/h) - 已脱机未插管</option>
                <option value="1.0">1.0 ml/h (2μg/kg/h)</option>
                <option value="1.5">1.5 ml/h (3μg/kg/h)</option>
                <option value="2.0">2.0 ml/h (4μg/kg/h)</option>
                <option value="2.5">2.5 ml/h (5μg/kg/h)</option>
                <option value="3.0">3.0 ml/h (6μg/kg/h) - 术后插管</option>
                <option value="3.5">3.5 ml/h (7μg/kg/h)</option>
                <option value="4.0">4.0 ml/h (8μg/kg/h)</option>
                <option value="4.5">4.5 ml/h (9μg/kg/h)</option>
            </select>
        </div>

        <button onclick="calculate()">立即计算</button>

        <div class="result" id="result">
            <!-- 结果将在此处动态显示 -->
        </div>
    </div>

    <script>
        function calculate() {
            // 获取输入值
            const weight = parseFloat(document.getElementById('weight').value);
            const speed = parseFloat(document.getElementById('speed').value);

            // 验证输入
            if (!weight || weight <= 0) {
                alert("请输入有效的体重！");
                return;
            }

            // 核心计算逻辑
            const totalDose = weight * 50; // 总剂量公式
            const concentration = 40; // 40μg/ml (1mg/25ml)
            const dosePerHour = (speed * concentration) / weight; // 实时剂量

            // 生成结果报告
            const resultHTML = `
                <strong>配置方法：</strong><br>
                1. 取 <span class="highlight">${totalDose}μg</span> 瑞芬太尼（${weight}kg × 50）<br>
                2. 加入生理盐水至25ml，浓度为 <span class="highlight">${concentration}μg/ml</span><br><br>

                <strong>当前输注参数：</strong><br>
                液体速度：<span class="highlight">${speed}ml/h</span><br>
                实时剂量：<span class="highlight">${dosePerHour.toFixed(1)}μg/kg/h</span>
            `;

            document.getElementById('result').innerHTML = resultHTML;
        }
    </script>
</body>
</html>